package com.imy.luascript.retrofit;

import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * 在此写用途
 *
 * @author: Imy
 * @date: 2017-03-06
 */
public class TransformUtils {
  public static <T> Observable.Transformer<T, T> defaultSchedulers() {
    return new Observable.Transformer<T, T>() {
      @Override
      public Observable<T> call(Observable<T> tObservable) {
        return tObservable.observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io());
      }
    };
  }

  public static <T> Observable.Transformer<T, T> all_io() {
    return new Observable.Transformer<T, T>() {
      @Override
      public Observable<T> call(Observable<T> tObservable) {
        return tObservable.observeOn(Schedulers.io()).subscribeOn(Schedulers.io());
      }
    };
  }
}
